import Vue from 'vue'

const apiUrl = 'api/'

export default {
  queryByPage (pageNo, pageSize = 10) {
    return Vue.http.get(apiUrl + 'customer/page', {params: {pageNo, pageSize}})
  },
  getCustomerById (id) {
    return Vue.http.get(apiUrl + 'customer/' + id)
  },
  saveCustomer (customer) {
    if (!customer.pkid) {
      return Vue.http.post(apiUrl + 'customer', customer)
    } else {
      return Vue.http.put(apiUrl + 'customer', customer)
    }
  },
  searchEnabledCustomer (condition) {
    return Vue.http.get(apiUrl + 'customer/enabled/' + condition)
  }
}
